package tp.badugi.net;

/**
 * The listener interface for receiving requests from server.
 * The class that is interested in processing server action requests implements this interface,
 * and the object created with that class is registered with a {@link ClientNetworkingChannel} instance
 * using the {@ ClientSocket#addActionRequestListener(ActionRequestListener)
 * addActionRequestListener} method. When the action request occurs, that object's
 * <code>actionRequested</code> method is invoked.
 * 
 * @author bartek
 *
 */
public interface iRequestListener {
	
	/**
	 * Indicates that a player folded. 
	 */
	public static final String ACTION_FOLD = ServerNetworkingChannel.ACTION_FOLD;
	
	/**
	 * Indicates that a player checked. 
	 */
	public static final String ACTION_CHECK = ServerNetworkingChannel.ACTION_CHECK;
	
	/**
	 * Indicates that a player made a bet. 
	 */
	public static final String ACTION_BET = ServerNetworkingChannel.ACTION_BET;
	
	/**
	 * Indicates that a player called. 
	 */
	public static final String ACTION_CALL = ServerNetworkingChannel.ACTION_CALL;
	
	/**
	 * Indicates that a player raised. 
	 */
	public static final String ACTION_RAISE = ServerNetworkingChannel.ACTION_RAISE;
	
	/**
	 * Indicates that a player went all-in. 
	 */
	public static final String ACTION_ALLIN = ServerNetworkingChannel.ACTION_ALLIN;
	

	/**
	 * Invoked when an action is requested.
	 * <p>
	 * The possible actions a player can perform are:
	 * {@link #ACTION_FOLD}, {@link #ACTION_CHECK}, {@link #ACTION_BET},
	 * {@link #ACTION_CALL}, {@link #ACTION_RAISE}, or {@link #ACTION_ALLIN}.
	 * 
	 * @param possibleActions array containing possible actions.
	 * @param betAmount the total amount of chips contributed to the pot by the player 
	 * who last bet or raised.
	 * @param minBet the smallest bet allowable (when {@link #ACTION_BET} is available).
	 * @param timeout response timeout in milliseconds.
	 */
	public void actionRequested(
			String[] possibleActions, 
			long betAmount, 
			long minBet, 
			int timeout
	);
	
	/**
	 * Invoked when the server sends a request to replace the player's cards.
	 * <p>
	 * The <code>currentCards</code> parameter is an array representing the player's current hand.
	 * Each card is represented by a two-character String. The first
	 * character signifies the rank (2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, A).
	 * And the second character signifies the suit (S, H, D, C).
	 * For example "QS" means a queen of spades.
	 * 
	 * @param currentCards player's current 4 cards.
	 * @param timeout response timeout in milliseconds.
	 */
	public void cardsRequested(String[] currentCards, int timeout);

}
